from django.middleware import csrf
from django.urls import path, include
from django.views.decorators.csrf import csrf_exempt
from .views import views
from django.views.generic.base import TemplateView

# url namespace
app_name = 'study'

urlpatterns = [
  path('', views.Index.as_view(), name='index'),
  path('courses/', views.Courses.as_view(), name='courses'),
  path('experiments/', views.Experiments.as_view(), name='experiments'),
  path('exams/', views.Exams.as_view(), name='exams'),
  path('login/', csrf_exempt(views.Login.as_view()), name='login'),
  path('bind/phone', views.BindPhone.as_view(), name='bindPhone'),
  path('wxlogin/back/', csrf_exempt(views.WxLoginBack.as_view()), name='wxLoginBack'),
  path('logout/', csrf_exempt(views.Logout.as_view()), name='logout'),
  path('login/pwd/', csrf_exempt(views.PwdLogin.as_view()), name='pwdLogin'),
  path('verify/code/', csrf_exempt(views.VerifyCode.as_view()), name='getVerifyCode'),
  path('course/<int:pk>/', views.CourseView.as_view(), name='course'),
  path('course/study/<int:pk>/', views.StudyingView.as_view(), name='studying'),
  path('course/buy/<int:pk>/', views.CourseBuy.as_view(), name='buyCourse'),
  path('experiment/buy/<int:pk>/', views.ExperimentBuy.as_view(), name='buyExperiment'),
  path('exam/buy/<int:pk>/', views.ExamBuy.as_view(), name='buyExam'),
  path('pay/notify', views.PayNotify.as_view(), name="payNotify"),
  path('pay/query/', csrf_exempt(views.PayQuery.as_view()), name="payQuery"),
  path('experiment/<int:pk>/', views.ExperimentView.as_view(), name="experimenting"),
  path('experiment/chapter/<int:pk>/<int:experiment_chapter_id>', views.StuExperimentChapterView.as_view(), name="experimentchapter"),
  path('experiment/<int:pk>/<tk>', views.ExperimentViewTK.as_view(), name='experimentViewTK'),
  path('report/<int:pk>/', views.ReportView.as_view(), name="report"),
  path('examing/<int:pk>/', views.ExamingView.as_view(), name="examing"),
  path('paper/<int:exam_id>/', views.PaperView.as_view(), name="paper"),
  path('exam/<int:pk>/', views.ExamView.as_view(), name="exam"),
  path('usercenter/', views.UserCenter.as_view(), name='userCenter'),
  path('user/course/', views.UserCourse.as_view(), name='userCourse'),
  path('user/experiment/', views.UserExperiment.as_view(), name='userExperiment'),
  path('user/exam/', views.UserExperiment.as_view(), name='userExam'),
  path('vnc/', views.InsVNCView.as_view(), name='vnc'),
  path('download/', views.Download.as_view(), name='download'),
]